package models.data;

import play.data.validation.Constraints;
import play.db.ebean.Model;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: olgak
 * Date: 5.3.2013
 * Time: 19:38
 * To change this template use File | Settings | File Templates.
 */
@Entity
public class Afangar extends Model {

    @Id
    @Constraints.Required
    public String afangi_id;
    @Constraints.Required
    public String afanga_heiti;
    public String namsgrein_afanganr;

    public static Finder<String,Afangar> find = new Finder<String,Afangar>(
            String.class, Afangar.class
    );

    public List<Afangar> getCourseList() {
        List<Afangar> courseList = Afangar.find.all();
        return courseList;
    }

    public static List<Afangar> fillCourseList(){
        List<Afangar> afangar = Afangar.find.where().eq("namsgrein_afanganr", "DAN313").findList();
        return afangar;
    }

    public static Afangar getAfangi(String id) {
        Afangar afangi = Afangar.find.byId(id);
        return afangi;
    }



}
